草庐IT

PHPUnit 和 CodeIgniter

全部标签

php - 在 codeigniter 中调试路由?

我想知道是否有任何简单的方法可以在codeigniter中调试路由?我希望能够在日志中看到以下内容:Clientsent:apps/somethingRoutefound:apps/(:any)-->applications/searchbyname/$1Redirecting:apps/something-->applications/searchbyname/something//andjustcausewecanletsmakethesearchbynamefunctionnotexistERROR-2012-09-1622:10:05-->404PageNotFound-->a

php - Netbeans-PHPUnit "No tests executed"错误

我是任何类型测试的新手。我刚刚使用这个doc安装了pear和PHPUnit.我使用netbeans7.3.1。我还安装了运行此命令的skeletongenerator:pearinstallphpunit/PHPUnit_SkeletonGenerator。我按照此testingwithPHPUnit中列出的步骤进行操作将PHPUnit集成到netbeans。如该文档的InstallingPHPUnit部分所述,通过单击Netbeans->preferences->unittesting下的search按钮,我的netbeans可以识别PHPUnit安装。我按照所有步骤添加示例Calc

php - CakePHP 3 : Unable to insert fixtures when running phpunit

我刚刚烘焙了一些Fixtures和一些TestCases,每当我运行vendor/bin/phpunit时,我都会得到以下错误的一个版本:$vendor/bin/phpunitPHPUnit4.7.7bySebastianBergmannandcontributors.IException:Unabletoinsertfixturesfor"App\Test\TestCase\Controller\ScreensControllerTest"testcase.SQLSTATE[HY000][2002]Nosuchfileordirectoryin[/Applications/MAMP/

PHPUnit:如何测试方法的调用顺序不正确?

我想使用PHPUnit来测试方法的调用顺序是否正确。我的第一次尝试是在模拟对象上使用->at(),但没有成功。例如,我预计以下操作会失败,但事实并非如此:publicfunctiontest_at_constraint(){$x=$this->getMock('FirstSecond',array('first','second'));$x->expects($this->at(0))->method('first');$x->expects($this->at(1))->method('second');$x->second();$x->first();}如果以错误的顺序调用事物,我

php - CodeIgniter 2.2.0 HMAC 不匹配错误

更新:即使下载了“已修复”的2.2.0,更新日志文件仍然充满:Session:HMACmismatch.Thesessioncookiedatadidnotmatchwhatwasexpected.从CodeIgniter2.1.3升级到2.2.0后出现错误:Session:HMACmismatch.Thesessioncookiedatadidnotmatchwhatwasexpected.Mcrypt扩展已启用。如果我设置$config['sess_encrypt_cookie']=FALSE;(不是生产选项)没有错误。非常感谢任何帮助。 最佳答案

php - 在 CodeIgniter 应用程序中实现服务层的正确方法

下面是在CodeIgniter应用程序中实现服务层的两种方式。第一种方法1.sendrequesttothecontroller2.callingservicelayermethodsfromcontroller3.returnprocessedresultdataset(D1)fromservicelayertocontroller4.thenaccordingtothatdatasetcontrollerdemanddatafrommodel5.modelreturndataset(D2)tothecontroller6.thencontrollersendseconddatase

php - Symfony4:Doctrine2 有效但在 PHPUnit 测试中没有连接(内核启动)

Symfony4中的奇怪问题:Doctrine有效,我可以使用phpbin/consoledoctrine:schema:create验证模式、创建数据库等。但是我的PHPUnit测试没有连接。通过运行./bin/phpunit我得到SQLSTATE[HY000][2002]Nosuchfileordirectory异常。我遵循了文档中有关启动内核的步骤:http://symfony.com/doc/current/testing/doctrine.html我的代码:classPersistingResultTestextendsKernelTestCase{protected$em;

php - Codeigniter 字符编码问题

我有几个没有数据库数据的简单页面,只是从Controller静态加载。我已将所有可能的设置为UTF-8编码。我检查了header,结果为UTF-8。但是,它仍然解析错误,显示这些字符:����。Controller:functionindex(){$this->load->view('french/header_view');$this->load->view('french/homepage_view');$this->load->view('french/footer_view');}配置文件:$config['charset']="UTF-8";标题View:....正文View

php - 使用 PHPUnit 设置测试超时持续时间

我有一些测试用例在失败时会进入无限循环。是否有内置方法可以使用PHPUnit设置测试超时持续时间?如果没有,将此功能添加到测试用例的最不显眼的方法是什么? 最佳答案 也许你可以使用PerformanceTestCase你可以用它设置一个setMaxRunningTime()进行测试。 关于php-使用PHPUnit设置测试超时持续时间,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions

php - Codeigniter CSRF token 问题

我做了一个简单的注册/时事通讯网站,但我遇到了一个奇怪的问题。有些人得到一个错误,说AnErrorWasEncounteredTheactionyouhaverequestedisnotallowed.我已经尝试过谷歌,发现当CSRF设置为true时,人们遇到了同样的问题。然而,我并不是每个人都会遇到,只是一小部分人。我正在使用form_open和form_close,我可以看到隐藏字段(token)。我使用的是最新版本的Codeigniter2.0.2这是我的Controllerfunction__construct(){parent::__construct();session_s